<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>class</title>
  <script src="../js/vue.js"></script>
  <style>
    .active {
      color: aqua;
    }
  </style>
</head>
<body>
  <div id="app">
    <h1 class="title" :class="{active:isActive,line:isLine}">{{message}}</h1>
    <h1 class="title" :class="getClasses()">{{message}}</h1>

    <button @click="btnClick">ddd</button>
  </div>
  
 
  <script>
    const app = new Vue({
      el: '#app',
      data: {
        message: 'hello',
        isActive: true,
        isLine: true
      },
      methods: {//注意作用域，要是#app里面的才可以
        btnClick: function(){
          this.isActive = !this.isActive
        },
        getClasses: function(){
          return {active:this.isActive,line:this.isLine}
        }
      }
    })
  </script>
</body>
</html>